| | | 1 | | // Copyright (c) 2020-2023 dotBunny Inc. |
| | | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | | 3 | | // See the LICENSE file in the project root for more information. |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using GDX.Collections; |
| | | 7 | | using UnityEngine; |
| | | 8 | | |
| | | 9 | | namespace GDX.Tables |
| | | 10 | | { |
| | | 11 | | |
| | | 12 | | [CreateAssetMenu(menuName = "GDX/Stable Table", fileName = "GDXStableTable")] |
| | | 13 | | [Serializable] |
| | | 14 | | public class StableTable : ScriptableObject, ITable |
| | | 15 | | { |
| | | 16 | | [Serializable] |
| | | 17 | | internal struct ColumnEntry |
| | | 18 | | { |
| | | 19 | | public Serializable.SerializableTypes ColumnType; |
| | | 20 | | public int columnDenseIndex; |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | [SerializeField] internal ArrayHolder<string>[] allStringColumns; |
| | | 24 | | [SerializeField] internal ArrayHolder<bool>[] allBoolColumns; |
| | | 25 | | [SerializeField] internal ArrayHolder<char>[] allCharColumns; |
| | | 26 | | [SerializeField] internal ArrayHolder<sbyte>[] allSbyteColumns; |
| | | 27 | | [SerializeField] internal ArrayHolder<byte>[] allByteColumns; |
| | | 28 | | [SerializeField] internal ArrayHolder<short>[] allShortColumns; |
| | | 29 | | [SerializeField] internal ArrayHolder<ushort>[] allUshortColumns; |
| | | 30 | | [SerializeField] internal ArrayHolder<int>[] allIntColumns; |
| | | 31 | | [SerializeField] internal ArrayHolder<uint>[] allUintColumns; |
| | | 32 | | [SerializeField] internal ArrayHolder<long>[] allLongColumns; |
| | | 33 | | [SerializeField] internal ArrayHolder<ulong>[] allUlongColumns; |
| | | 34 | | [SerializeField] internal ArrayHolder<float>[] allFloatColumns; |
| | | 35 | | [SerializeField] internal ArrayHolder<double>[] allDoubleColumns; |
| | | 36 | | [SerializeField] internal ArrayHolder<Vector2>[] allVector2Columns; |
| | | 37 | | [SerializeField] internal ArrayHolder<Vector3>[] allVector3Columns; |
| | | 38 | | [SerializeField] internal ArrayHolder<Vector4>[] allVector4Columns; |
| | | 39 | | [SerializeField] internal ArrayHolder<Vector2Int>[] allVector2IntColumns; |
| | | 40 | | [SerializeField] internal ArrayHolder<Vector3Int>[] allVector3IntColumns; |
| | | 41 | | [SerializeField] internal ArrayHolder<Quaternion>[] allQuaternionColumns; |
| | | 42 | | [SerializeField] internal ArrayHolder<Rect>[] allRectColumns; |
| | | 43 | | [SerializeField] internal ArrayHolder<RectInt>[] allRectIntColumns; |
| | | 44 | | [SerializeField] internal ArrayHolder<Color>[] allColorColumns; |
| | | 45 | | [SerializeField] internal ArrayHolder<LayerMask>[] allLayerMaskColumns; |
| | | 46 | | [SerializeField] internal ArrayHolder<Bounds>[] allBoundsColumns; |
| | | 47 | | [SerializeField] internal ArrayHolder<BoundsInt>[] allBoundsIntColumns; |
| | | 48 | | [SerializeField] internal ArrayHolder<Hash128>[] allHash128Columns; |
| | | 49 | | [SerializeField] internal ArrayHolder<Gradient>[] allGradientColumns; |
| | | 50 | | [SerializeField] internal ArrayHolder<AnimationCurve>[] allAnimationCurveColumns; |
| | | 51 | | [SerializeField] internal ArrayHolder<UnityEngine.Object>[] allObjectRefColumns; |
| | 0 | 52 | | [SerializeField] internal ArrayHolder<string>[] allColumnNames = new ArrayHolder<string>[Serializable.Serializab |
| | | 53 | | |
| | | 54 | | [SerializeField] internal int[] rowIDToDenseIndexMap; |
| | | 55 | | [SerializeField] internal int[] rowDenseIndexToIDMap; |
| | | 56 | | [SerializeField] internal string[] rowNames; |
| | | 57 | | [SerializeField] internal int rowEntriesFreeListHead; |
| | | 58 | | |
| | | 59 | | [SerializeField] |
| | | 60 | | internal int rowCount; |
| | | 61 | | |
| | | 62 | | [SerializeField] internal ColumnEntry[] columnIDToDenseIndexMap; |
| | | 63 | | [SerializeField] internal int[] columnIDToSortOrderMap; |
| | | 64 | | [SerializeField] internal int[] sortedOrderToColumnIDMap; |
| | | 65 | | |
| | | 66 | | // TODO move with other block |
| | 0 | 67 | | [SerializeField] ArrayHolder<int>[] columnDenseIndexToIDMap = new ArrayHolder<int>[Serializable.SerializableType |
| | | 68 | | |
| | | 69 | | [SerializeField] |
| | | 70 | | internal int columnEntriesFreeListHead; |
| | | 71 | | |
| | | 72 | | [SerializeField] |
| | | 73 | | internal int combinedColumnCount; |
| | | 74 | | |
| | | 75 | | [SerializeField] |
| | 0 | 76 | | internal ulong dataVersion = 1; |
| | | 77 | | |
| | | 78 | | |
| | | 79 | | public ulong GetDataVersion() |
| | 0 | 80 | | { |
| | 0 | 81 | | return dataVersion; |
| | 0 | 82 | | } |
| | | 83 | | |
| | | 84 | | /// <inheritdoc /> |
| | | 85 | | public int GetColumnCount() |
| | 0 | 86 | | { |
| | 0 | 87 | | return combinedColumnCount; |
| | 0 | 88 | | } |
| | | 89 | | |
| | | 90 | | /// <inheritdoc /> |
| | | 91 | | public int GetRowCount() |
| | 0 | 92 | | { |
| | 0 | 93 | | return rowCount; |
| | 0 | 94 | | } |
| | | 95 | | |
| | | 96 | | public ITable.RowDescription[] GetAllRowDescriptions() |
| | 0 | 97 | | { |
| | 0 | 98 | | if (combinedColumnCount == 0 || rowCount == 0) return null; |
| | 0 | 99 | | ITable.RowDescription[] returnArray = new ITable.RowDescription[rowCount]; |
| | 0 | 100 | | string empty = string.Empty; |
| | 0 | 101 | | for (int i = 0; i < rowCount; i++) |
| | 0 | 102 | | { |
| | 0 | 103 | | returnArray[i].Index = rowDenseIndexToIDMap[i]; |
| | 0 | 104 | | returnArray[i].Name = empty; |
| | 0 | 105 | | } |
| | | 106 | | |
| | 0 | 107 | | return returnArray; |
| | 0 | 108 | | } |
| | | 109 | | public ITable.RowDescription GetRowDescription(string name) |
| | 0 | 110 | | { |
| | 0 | 111 | | for (int i = 0; i < rowCount; i++) |
| | 0 | 112 | | { |
| | 0 | 113 | | string nameAt = rowNames[i]; |
| | | 114 | | |
| | 0 | 115 | | if (nameAt == name) |
| | 0 | 116 | | { |
| | 0 | 117 | | return new ITable.RowDescription |
| | | 118 | | { |
| | | 119 | | Index = rowDenseIndexToIDMap[i], |
| | | 120 | | Name = nameAt |
| | | 121 | | }; |
| | | 122 | | } |
| | 0 | 123 | | } |
| | | 124 | | |
| | 0 | 125 | | throw new ArgumentException("Row with name " + name + " does not exist in the table"); |
| | 0 | 126 | | } |
| | | 127 | | |
| | | 128 | | public ITable.RowDescription GetRowDescription(int order) |
| | 0 | 129 | | { |
| | 0 | 130 | | return new ITable.RowDescription |
| | | 131 | | { |
| | | 132 | | Index = rowDenseIndexToIDMap[order], |
| | | 133 | | Name = rowNames[order] |
| | | 134 | | }; |
| | 0 | 135 | | } |
| | | 136 | | |
| | | 137 | | public ITable.ColumnDescription GetColumnDescription(string name) |
| | 0 | 138 | | { |
| | 0 | 139 | | for (int i = 0; i < Serializable.SerializableTypesCount; i++) |
| | 0 | 140 | | { |
| | 0 | 141 | | string[] columnNames = allColumnNames[i].TArray; |
| | | 142 | | |
| | 0 | 143 | | if (columnNames != null) |
| | 0 | 144 | | { |
| | 0 | 145 | | for (int j = 0; j < columnNames.Length; j++) |
| | 0 | 146 | | { |
| | 0 | 147 | | string nameAt = columnNames[j]; |
| | | 148 | | |
| | 0 | 149 | | if (name == nameAt) |
| | 0 | 150 | | { |
| | 0 | 151 | | int columnID = columnDenseIndexToIDMap[i].TArray[j]; |
| | | 152 | | |
| | 0 | 153 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 154 | | return new ITable.ColumnDescription |
| | | 155 | | { |
| | | 156 | | Index = columnID, |
| | | 157 | | Name = nameAt, |
| | | 158 | | Type = columnEntry.ColumnType |
| | | 159 | | }; |
| | | 160 | | } |
| | 0 | 161 | | } |
| | 0 | 162 | | } |
| | 0 | 163 | | } |
| | | 164 | | |
| | 0 | 165 | | throw new ArgumentException("Column with name " + name + " does not exist in the table"); |
| | 0 | 166 | | } |
| | | 167 | | |
| | | 168 | | public ITable.ColumnDescription GetColumnDescription(int order) |
| | 0 | 169 | | { |
| | 0 | 170 | | int idAtOrderedIndex = sortedOrderToColumnIDMap[order]; |
| | 0 | 171 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[idAtOrderedIndex]; |
| | | 172 | | |
| | 0 | 173 | | string columnName = allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex]; |
| | | 174 | | |
| | 0 | 175 | | return new ITable.ColumnDescription |
| | | 176 | | { |
| | | 177 | | Index = idAtOrderedIndex, |
| | | 178 | | Name = columnName, |
| | | 179 | | Type = columnEntry.ColumnType |
| | | 180 | | }; |
| | 0 | 181 | | } |
| | | 182 | | |
| | | 183 | | /// <inheritdoc /> |
| | | 184 | | public ITable.ColumnDescription[] GetAllColumnDescriptions() |
| | 0 | 185 | | { |
| | 0 | 186 | | if (combinedColumnCount == 0) return null; |
| | 0 | 187 | | ITable.ColumnDescription[] returnArray = new ITable.ColumnDescription[combinedColumnCount]; |
| | | 188 | | |
| | 0 | 189 | | for (int i = 0; i < combinedColumnCount; i++) |
| | 0 | 190 | | { |
| | 0 | 191 | | int columnID = sortedOrderToColumnIDMap[i]; |
| | 0 | 192 | | Serializable.SerializableTypes columnType = columnIDToDenseIndexMap[columnID].ColumnType; |
| | 0 | 193 | | string name = allColumnNames[(int)columnType][columnIDToDenseIndexMap[columnID].columnDenseIndex]; |
| | | 194 | | |
| | 0 | 195 | | returnArray[i] = new ITable.ColumnDescription |
| | | 196 | | { |
| | | 197 | | Name = name, |
| | | 198 | | Index = columnID, |
| | | 199 | | Type = columnType |
| | | 200 | | }; |
| | 0 | 201 | | } |
| | | 202 | | |
| | 0 | 203 | | return returnArray; |
| | 0 | 204 | | } |
| | | 205 | | |
| | | 206 | | public void SetColumnName(string name, int columnID) |
| | 0 | 207 | | { |
| | 0 | 208 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 209 | | allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex] = name; |
| | 0 | 210 | | } |
| | | 211 | | |
| | | 212 | | public string GetColumnName(int columnID) |
| | 0 | 213 | | { |
| | 0 | 214 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 215 | | return allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex]; |
| | 0 | 216 | | } |
| | | 217 | | |
| | | 218 | | public ref string GetColumnNameRef(int columnID) |
| | 0 | 219 | | { |
| | 0 | 220 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 221 | | return ref allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex]; |
| | 0 | 222 | | } |
| | | 223 | | |
| | | 224 | | |
| | | 225 | | public int AddRow(string rowName = null, int insertAtRowID = -1) |
| | 0 | 226 | | { |
| | 0 | 227 | | int rowID = rowEntriesFreeListHead; |
| | 0 | 228 | | int rowIDToDenseIndexMapLength = rowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 229 | | if (rowID >= rowIDToDenseIndexMapLength) |
| | 0 | 230 | | { |
| | 0 | 231 | | int newSize = rowID * 2; |
| | 0 | 232 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 233 | | Array.Resize(ref rowIDToDenseIndexMap, newSize); |
| | 0 | 234 | | for (int i = rowID; i < newSize; i++) |
| | 0 | 235 | | { |
| | 0 | 236 | | rowIDToDenseIndexMap[rowID + i] = rowID + i + 1; |
| | 0 | 237 | | } |
| | 0 | 238 | | } |
| | | 239 | | |
| | 0 | 240 | | int denseIndexToIDMapLength = rowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 241 | | Array.Resize(ref rowDenseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 242 | | Array.Resize(ref rowNames, denseIndexToIDMapLength + 1); |
| | | 243 | | |
| | 0 | 244 | | int insertAt = insertAtRowID < 0 ? rowCount : rowIDToDenseIndexMap[insertAtRowID]; |
| | | 245 | | |
| | 0 | 246 | | for (int i = denseIndexToIDMapLength; i > insertAt; i--) |
| | 0 | 247 | | { |
| | 0 | 248 | | int currentRowID = rowDenseIndexToIDMap[i - 1]; |
| | 0 | 249 | | rowDenseIndexToIDMap[i] = currentRowID; |
| | | 250 | | |
| | 0 | 251 | | rowIDToDenseIndexMap[currentRowID] = i; |
| | | 252 | | |
| | 0 | 253 | | rowNames[i] = rowNames[i - 1]; |
| | 0 | 254 | | } |
| | | 255 | | |
| | 0 | 256 | | rowEntriesFreeListHead = rowIDToDenseIndexMap[rowID]; |
| | 0 | 257 | | rowIDToDenseIndexMap[rowID] = insertAt; |
| | 0 | 258 | | rowDenseIndexToIDMap[insertAt] = rowID; |
| | 0 | 259 | | rowNames[insertAt] = rowName == null ? string.Empty : rowName; |
| | | 260 | | |
| | 0 | 261 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, 1); |
| | 0 | 262 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, 1); |
| | 0 | 263 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, 1); |
| | 0 | 264 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, 1); |
| | 0 | 265 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, 1); |
| | 0 | 266 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, 1); |
| | 0 | 267 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, 1); |
| | 0 | 268 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, 1); |
| | 0 | 269 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, 1); |
| | 0 | 270 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, 1); |
| | 0 | 271 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, 1); |
| | 0 | 272 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, 1); |
| | 0 | 273 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, 1); |
| | 0 | 274 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, 1); |
| | 0 | 275 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, 1); |
| | 0 | 276 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, 1); |
| | 0 | 277 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, 1); |
| | 0 | 278 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, 1); |
| | 0 | 279 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, 1); |
| | 0 | 280 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, 1); |
| | 0 | 281 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, 1); |
| | 0 | 282 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, 1); |
| | 0 | 283 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, 1); |
| | 0 | 284 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, 1); |
| | 0 | 285 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, 1); |
| | 0 | 286 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, 1); |
| | 0 | 287 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, 1); |
| | 0 | 288 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, 1); |
| | 0 | 289 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, 1); |
| | | 290 | | |
| | 0 | 291 | | ++rowCount; |
| | 0 | 292 | | dataVersion++; |
| | | 293 | | |
| | 0 | 294 | | return rowID; |
| | 0 | 295 | | } |
| | | 296 | | |
| | | 297 | | public void AddRows(int numberOfNewRows, string[] rowNames = null, int insertAtRowID = -1) |
| | 0 | 298 | | { |
| | 0 | 299 | | int rowIDToDenseIndexMapLength = rowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 300 | | int newCount = rowCount + numberOfNewRows; |
| | 0 | 301 | | if (newCount > rowIDToDenseIndexMapLength) |
| | 0 | 302 | | { |
| | 0 | 303 | | int newSize = newCount; |
| | 0 | 304 | | --newSize; |
| | 0 | 305 | | newSize |= newSize >> 1; |
| | 0 | 306 | | newSize |= newSize >> 2; |
| | 0 | 307 | | newSize |= newSize >> 4; |
| | 0 | 308 | | newSize |= newSize >> 8; |
| | 0 | 309 | | newSize |= newSize >> 16; |
| | 0 | 310 | | ++newSize; |
| | | 311 | | |
| | 0 | 312 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 313 | | Array.Resize(ref rowIDToDenseIndexMap, newSize); |
| | 0 | 314 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 315 | | { |
| | 0 | 316 | | rowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 317 | | } |
| | 0 | 318 | | } |
| | | 319 | | |
| | 0 | 320 | | int denseIndexToIDMapLength = rowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 321 | | Array.Resize(ref rowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| | 0 | 322 | | Array.Resize(ref rowNames, denseIndexToIDMapLength + numberOfNewRows); |
| | | 323 | | |
| | 0 | 324 | | int insertAt = insertAtRowID < 0 ? rowCount : rowIDToDenseIndexMap[insertAtRowID]; |
| | | 325 | | |
| | 0 | 326 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| | 0 | 327 | | { |
| | 0 | 328 | | int currentRowID = rowDenseIndexToIDMap[i - numberOfNewRows]; |
| | 0 | 329 | | rowDenseIndexToIDMap[i] = currentRowID; |
| | | 330 | | |
| | 0 | 331 | | rowIDToDenseIndexMap[currentRowID] = i; |
| | | 332 | | |
| | 0 | 333 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| | 0 | 334 | | } |
| | | 335 | | |
| | 0 | 336 | | int freeListHead = rowEntriesFreeListHead; |
| | | 337 | | |
| | 0 | 338 | | for (int i = 0; i < numberOfNewRows; i++) |
| | 0 | 339 | | { |
| | 0 | 340 | | int rowID = freeListHead; |
| | 0 | 341 | | freeListHead = rowIDToDenseIndexMap[rowID]; |
| | 0 | 342 | | rowIDToDenseIndexMap[rowID] = insertAt + i; |
| | 0 | 343 | | rowDenseIndexToIDMap[insertAt + i] = rowID; |
| | 0 | 344 | | } |
| | | 345 | | |
| | 0 | 346 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| | 0 | 347 | | string emptyString = string.Empty; |
| | 0 | 348 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| | 0 | 349 | | { |
| | 0 | 350 | | string currentRowName = rowNames[i]; |
| | 0 | 351 | | rowNames[insertAt + i] = currentRowName == null ? emptyString : currentRowName; |
| | 0 | 352 | | } |
| | | 353 | | |
| | 0 | 354 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| | 0 | 355 | | { |
| | 0 | 356 | | rowNames[insertAt + i] = string.Empty; |
| | 0 | 357 | | } |
| | | 358 | | |
| | 0 | 359 | | rowEntriesFreeListHead = freeListHead; |
| | | 360 | | |
| | 0 | 361 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, numberOfNewRows); |
| | 0 | 362 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 363 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, numberOfNewRows); |
| | 0 | 364 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 365 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, numberOfNewRows); |
| | 0 | 366 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, numberOfNewRows); |
| | 0 | 367 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 368 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, numberOfNewRows); |
| | 0 | 369 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, numberOfNewRows); |
| | 0 | 370 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, numberOfNewRows); |
| | 0 | 371 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 372 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 373 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 374 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 375 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 376 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 377 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 378 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 379 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 380 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, numberOfNewRows); |
| | 0 | 381 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 382 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, numberOfNewRows); |
| | 0 | 383 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 384 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 385 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 386 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 387 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 388 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 389 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, numberOfNewRows); |
| | | 390 | | |
| | 0 | 391 | | rowCount += numberOfNewRows; |
| | 0 | 392 | | dataVersion++; |
| | 0 | 393 | | } |
| | | 394 | | |
| | | 395 | | public void AddRows(int numberOfNewRows, ref int[] rowIDs, string[] rowNames = null, int insertAtRowID = -1) |
| | 0 | 396 | | { |
| | 0 | 397 | | int rowIDToDenseIndexMapLength = rowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 398 | | int newCount = rowCount + numberOfNewRows; |
| | 0 | 399 | | if (newCount > rowIDToDenseIndexMapLength) |
| | 0 | 400 | | { |
| | 0 | 401 | | int newSize = newCount; |
| | 0 | 402 | | --newSize; |
| | 0 | 403 | | newSize |= newSize >> 1; |
| | 0 | 404 | | newSize |= newSize >> 2; |
| | 0 | 405 | | newSize |= newSize >> 4; |
| | 0 | 406 | | newSize |= newSize >> 8; |
| | 0 | 407 | | newSize |= newSize >> 16; |
| | 0 | 408 | | ++newSize; |
| | | 409 | | |
| | 0 | 410 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 411 | | Array.Resize(ref rowIDToDenseIndexMap, newSize); |
| | 0 | 412 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 413 | | { |
| | 0 | 414 | | rowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 415 | | } |
| | 0 | 416 | | } |
| | | 417 | | |
| | 0 | 418 | | int denseIndexToIDMapLength = rowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 419 | | Array.Resize(ref rowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| | | 420 | | |
| | 0 | 421 | | int insertAt = insertAtRowID < 0 ? rowCount : rowIDToDenseIndexMap[insertAtRowID]; |
| | | 422 | | |
| | 0 | 423 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| | 0 | 424 | | { |
| | 0 | 425 | | int currentRowID = rowDenseIndexToIDMap[i - numberOfNewRows]; |
| | 0 | 426 | | rowDenseIndexToIDMap[i] = currentRowID; |
| | | 427 | | |
| | 0 | 428 | | rowIDToDenseIndexMap[currentRowID] = i; |
| | | 429 | | |
| | 0 | 430 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| | 0 | 431 | | } |
| | | 432 | | |
| | 0 | 433 | | int freeListHead = rowEntriesFreeListHead; |
| | | 434 | | |
| | 0 | 435 | | for (int i = 0; i < numberOfNewRows; i++) |
| | 0 | 436 | | { |
| | 0 | 437 | | int rowID = freeListHead; |
| | 0 | 438 | | freeListHead = rowIDToDenseIndexMap[rowID]; |
| | 0 | 439 | | rowIDToDenseIndexMap[rowID] = insertAt + i; |
| | 0 | 440 | | rowDenseIndexToIDMap[insertAt + i] = rowID; |
| | 0 | 441 | | rowIDs[i] = rowID; |
| | 0 | 442 | | } |
| | | 443 | | |
| | 0 | 444 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| | 0 | 445 | | string emptyString = string.Empty; |
| | 0 | 446 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| | 0 | 447 | | { |
| | 0 | 448 | | string currentRowName = rowNames[i]; |
| | 0 | 449 | | rowNames[insertAt + i] = currentRowName == null ? emptyString : currentRowName; |
| | 0 | 450 | | } |
| | | 451 | | |
| | 0 | 452 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| | 0 | 453 | | { |
| | 0 | 454 | | rowNames[insertAt + i] = string.Empty; |
| | 0 | 455 | | } |
| | | 456 | | |
| | 0 | 457 | | rowEntriesFreeListHead = freeListHead; |
| | | 458 | | |
| | 0 | 459 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, numberOfNewRows); |
| | 0 | 460 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 461 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, numberOfNewRows); |
| | 0 | 462 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 463 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, numberOfNewRows); |
| | 0 | 464 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, numberOfNewRows); |
| | 0 | 465 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 466 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, numberOfNewRows); |
| | 0 | 467 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, numberOfNewRows); |
| | 0 | 468 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, numberOfNewRows); |
| | 0 | 469 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 470 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 471 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 472 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 473 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 474 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 475 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 476 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 477 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 478 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, numberOfNewRows); |
| | 0 | 479 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 480 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, numberOfNewRows); |
| | 0 | 481 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 482 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 483 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 484 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 485 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 486 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 487 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, numberOfNewRows); |
| | | 488 | | |
| | 0 | 489 | | rowCount += numberOfNewRows; |
| | 0 | 490 | | dataVersion++; |
| | 0 | 491 | | } |
| | | 492 | | |
| | | 493 | | public void RemoveRow(int rowID) |
| | 0 | 494 | | { |
| | 0 | 495 | | int rowDenseIndex = rowIDToDenseIndexMap[rowID]; |
| | 0 | 496 | | for (int i = rowDenseIndex + 1; i < rowCount; i++) |
| | 0 | 497 | | { |
| | 0 | 498 | | int currentRowID = rowDenseIndexToIDMap[i]; |
| | 0 | 499 | | rowIDToDenseIndexMap[currentRowID] = i - 1; |
| | 0 | 500 | | rowDenseIndexToIDMap[i - 1] = currentRowID; |
| | 0 | 501 | | rowNames[i - 1] = rowNames[i]; |
| | 0 | 502 | | } |
| | | 503 | | |
| | 0 | 504 | | rowIDToDenseIndexMap[rowID] = rowEntriesFreeListHead; |
| | 0 | 505 | | rowEntriesFreeListHead = rowID; |
| | 0 | 506 | | Array.Resize(ref rowDenseIndexToIDMap, rowCount - 1); |
| | 0 | 507 | | Array.Resize(ref rowNames, rowCount - 1); |
| | | 508 | | |
| | 0 | 509 | | DeleteRowsOfTypeInternal(ref allStringColumns, rowID, 1); |
| | 0 | 510 | | DeleteRowsOfTypeInternal(ref allBoolColumns, rowID, 1); |
| | 0 | 511 | | DeleteRowsOfTypeInternal(ref allCharColumns, rowID, 1); |
| | 0 | 512 | | DeleteRowsOfTypeInternal(ref allSbyteColumns, rowID, 1); |
| | 0 | 513 | | DeleteRowsOfTypeInternal(ref allByteColumns, rowID, 1); |
| | 0 | 514 | | DeleteRowsOfTypeInternal(ref allShortColumns, rowID, 1); |
| | 0 | 515 | | DeleteRowsOfTypeInternal(ref allUshortColumns, rowID, 1); |
| | 0 | 516 | | DeleteRowsOfTypeInternal(ref allIntColumns, rowID, 1); |
| | 0 | 517 | | DeleteRowsOfTypeInternal(ref allUintColumns, rowID, 1); |
| | 0 | 518 | | DeleteRowsOfTypeInternal(ref allLongColumns, rowID, 1); |
| | 0 | 519 | | DeleteRowsOfTypeInternal(ref allUlongColumns, rowID, 1); |
| | 0 | 520 | | DeleteRowsOfTypeInternal(ref allFloatColumns, rowID, 1); |
| | 0 | 521 | | DeleteRowsOfTypeInternal(ref allDoubleColumns, rowID, 1); |
| | 0 | 522 | | DeleteRowsOfTypeInternal(ref allVector2Columns, rowID, 1); |
| | 0 | 523 | | DeleteRowsOfTypeInternal(ref allVector3Columns, rowID, 1); |
| | 0 | 524 | | DeleteRowsOfTypeInternal(ref allVector4Columns, rowID, 1); |
| | 0 | 525 | | DeleteRowsOfTypeInternal(ref allVector2IntColumns, rowID, 1); |
| | 0 | 526 | | DeleteRowsOfTypeInternal(ref allVector3IntColumns, rowID, 1); |
| | 0 | 527 | | DeleteRowsOfTypeInternal(ref allQuaternionColumns, rowID, 1); |
| | 0 | 528 | | DeleteRowsOfTypeInternal(ref allRectColumns, rowID, 1); |
| | 0 | 529 | | DeleteRowsOfTypeInternal(ref allRectIntColumns, rowID, 1); |
| | 0 | 530 | | DeleteRowsOfTypeInternal(ref allColorColumns, rowID, 1); |
| | 0 | 531 | | DeleteRowsOfTypeInternal(ref allLayerMaskColumns, rowID, 1); |
| | 0 | 532 | | DeleteRowsOfTypeInternal(ref allBoundsColumns, rowID, 1); |
| | 0 | 533 | | DeleteRowsOfTypeInternal(ref allBoundsIntColumns, rowID, 1); |
| | 0 | 534 | | DeleteRowsOfTypeInternal(ref allHash128Columns, rowID, 1); |
| | 0 | 535 | | DeleteRowsOfTypeInternal(ref allGradientColumns, rowID, 1); |
| | 0 | 536 | | DeleteRowsOfTypeInternal(ref allAnimationCurveColumns, rowID, 1); |
| | 0 | 537 | | DeleteRowsOfTypeInternal(ref allObjectRefColumns, rowID, 1); |
| | | 538 | | |
| | 0 | 539 | | --rowCount; |
| | 0 | 540 | | dataVersion++; |
| | 0 | 541 | | } |
| | | 542 | | |
| | | 543 | | public int AddColumn(Serializable.SerializableTypes columnType, string columnName, int insertAtColumnID = -1) |
| | 0 | 544 | | { |
| | 0 | 545 | | switch (columnType) |
| | | 546 | | { |
| | | 547 | | case Serializable.SerializableTypes.String: |
| | 0 | 548 | | return AddColumnInternal(columnName, ref allStringColumns, Serializable.SerializableTypes.String, in |
| | | 549 | | case Serializable.SerializableTypes.Char: |
| | 0 | 550 | | return AddColumnInternal(columnName, ref allCharColumns, Serializable.SerializableTypes.Char, insert |
| | | 551 | | case Serializable.SerializableTypes.Bool: |
| | 0 | 552 | | return AddColumnInternal(columnName, ref allBoolColumns, Serializable.SerializableTypes.Bool, insert |
| | | 553 | | case Serializable.SerializableTypes.SByte: |
| | 0 | 554 | | return AddColumnInternal(columnName, ref allSbyteColumns, Serializable.SerializableTypes.SByte, inse |
| | | 555 | | case Serializable.SerializableTypes.Byte: |
| | 0 | 556 | | return AddColumnInternal(columnName, ref allByteColumns, Serializable.SerializableTypes.Byte, insert |
| | | 557 | | case Serializable.SerializableTypes.Short: |
| | 0 | 558 | | return AddColumnInternal(columnName, ref allShortColumns, Serializable.SerializableTypes.Short, inse |
| | | 559 | | case Serializable.SerializableTypes.UShort: |
| | 0 | 560 | | return AddColumnInternal(columnName, ref allUshortColumns, Serializable.SerializableTypes.UShort, in |
| | | 561 | | case Serializable.SerializableTypes.Int: |
| | 0 | 562 | | return AddColumnInternal(columnName, ref allIntColumns, Serializable.SerializableTypes.Int, insertAt |
| | | 563 | | case Serializable.SerializableTypes.UInt: |
| | 0 | 564 | | return AddColumnInternal(columnName, ref allUintColumns, Serializable.SerializableTypes.UInt, insert |
| | | 565 | | case Serializable.SerializableTypes.Long: |
| | 0 | 566 | | return AddColumnInternal(columnName, ref allLongColumns, Serializable.SerializableTypes.Long, insert |
| | | 567 | | case Serializable.SerializableTypes.ULong: |
| | 0 | 568 | | return AddColumnInternal(columnName, ref allUlongColumns, Serializable.SerializableTypes.ULong, inse |
| | | 569 | | case Serializable.SerializableTypes.Float: |
| | 0 | 570 | | return AddColumnInternal(columnName, ref allFloatColumns, Serializable.SerializableTypes.Float, inse |
| | | 571 | | case Serializable.SerializableTypes.Double: |
| | 0 | 572 | | return AddColumnInternal(columnName, ref allDoubleColumns, Serializable.SerializableTypes.Double, in |
| | | 573 | | case Serializable.SerializableTypes.Vector2: |
| | 0 | 574 | | return AddColumnInternal(columnName, ref allVector2Columns, Serializable.SerializableTypes.Vector2, |
| | | 575 | | case Serializable.SerializableTypes.Vector3: |
| | 0 | 576 | | return AddColumnInternal(columnName, ref allVector3Columns, Serializable.SerializableTypes.Vector3, |
| | | 577 | | case Serializable.SerializableTypes.Vector4: |
| | 0 | 578 | | return AddColumnInternal(columnName, ref allVector4Columns, Serializable.SerializableTypes.Vector4, |
| | | 579 | | case Serializable.SerializableTypes.Vector2Int: |
| | 0 | 580 | | return AddColumnInternal(columnName, ref allVector2IntColumns, Serializable.SerializableTypes.Vector |
| | | 581 | | case Serializable.SerializableTypes.Vector3Int: |
| | 0 | 582 | | return AddColumnInternal(columnName, ref allVector3IntColumns, Serializable.SerializableTypes.Vector |
| | | 583 | | case Serializable.SerializableTypes.Quaternion: |
| | 0 | 584 | | return AddColumnInternal(columnName, ref allQuaternionColumns, Serializable.SerializableTypes.Quater |
| | | 585 | | case Serializable.SerializableTypes.Rect: |
| | 0 | 586 | | return AddColumnInternal(columnName, ref allRectColumns, Serializable.SerializableTypes.Rect, insert |
| | | 587 | | case Serializable.SerializableTypes.RectInt: |
| | 0 | 588 | | return AddColumnInternal(columnName, ref allRectIntColumns, Serializable.SerializableTypes.RectInt, |
| | | 589 | | case Serializable.SerializableTypes.Color: |
| | 0 | 590 | | return AddColumnInternal(columnName, ref allColorColumns, Serializable.SerializableTypes.Color, inse |
| | | 591 | | case Serializable.SerializableTypes.LayerMask: |
| | 0 | 592 | | return AddColumnInternal(columnName, ref allLayerMaskColumns, Serializable.SerializableTypes.LayerMa |
| | | 593 | | case Serializable.SerializableTypes.Bounds: |
| | 0 | 594 | | return AddColumnInternal(columnName, ref allBoundsColumns, Serializable.SerializableTypes.Bounds, in |
| | | 595 | | case Serializable.SerializableTypes.BoundsInt: |
| | 0 | 596 | | return AddColumnInternal(columnName, ref allBoundsIntColumns, Serializable.SerializableTypes.BoundsI |
| | | 597 | | case Serializable.SerializableTypes.Hash128: |
| | 0 | 598 | | return AddColumnInternal(columnName, ref allHash128Columns, Serializable.SerializableTypes.Hash128, |
| | | 599 | | case Serializable.SerializableTypes.Gradient: |
| | 0 | 600 | | return AddColumnInternal(columnName, ref allGradientColumns, Serializable.SerializableTypes.Gradient |
| | | 601 | | case Serializable.SerializableTypes.AnimationCurve: |
| | 0 | 602 | | return AddColumnInternal(columnName, ref allAnimationCurveColumns, Serializable.SerializableTypes.An |
| | | 603 | | case Serializable.SerializableTypes.Object: |
| | 0 | 604 | | return AddColumnInternal(columnName, ref allObjectRefColumns, Serializable.SerializableTypes.Object, |
| | | 605 | | } |
| | 0 | 606 | | return -1; |
| | 0 | 607 | | } |
| | | 608 | | |
| | | 609 | | public void RemoveColumn(Serializable.SerializableTypes columnType, int columnID) |
| | 0 | 610 | | { |
| | 0 | 611 | | switch (columnType) |
| | | 612 | | { |
| | | 613 | | case Serializable.SerializableTypes.String: |
| | 0 | 614 | | RemoveColumnInternal(ref allStringColumns, Serializable.SerializableTypes.String, columnID); |
| | 0 | 615 | | break; |
| | | 616 | | case Serializable.SerializableTypes.Char: |
| | 0 | 617 | | RemoveColumnInternal(ref allCharColumns, Serializable.SerializableTypes.Char, columnID); |
| | 0 | 618 | | break; |
| | | 619 | | case Serializable.SerializableTypes.Bool: |
| | 0 | 620 | | RemoveColumnInternal(ref allBoolColumns, Serializable.SerializableTypes.Bool, columnID); |
| | 0 | 621 | | break; |
| | | 622 | | case Serializable.SerializableTypes.SByte: |
| | 0 | 623 | | RemoveColumnInternal(ref allSbyteColumns, Serializable.SerializableTypes.SByte, columnID); |
| | 0 | 624 | | break; |
| | | 625 | | case Serializable.SerializableTypes.Byte: |
| | 0 | 626 | | RemoveColumnInternal(ref allByteColumns, Serializable.SerializableTypes.Byte, columnID); |
| | 0 | 627 | | break; |
| | | 628 | | case Serializable.SerializableTypes.Short: |
| | 0 | 629 | | RemoveColumnInternal(ref allShortColumns, Serializable.SerializableTypes.Short, columnID); |
| | 0 | 630 | | break; |
| | | 631 | | case Serializable.SerializableTypes.UShort: |
| | 0 | 632 | | RemoveColumnInternal(ref allUshortColumns, Serializable.SerializableTypes.UShort, columnID); |
| | 0 | 633 | | break; |
| | | 634 | | case Serializable.SerializableTypes.Int: |
| | 0 | 635 | | RemoveColumnInternal(ref allIntColumns, Serializable.SerializableTypes.Int, columnID); |
| | 0 | 636 | | break; |
| | | 637 | | case Serializable.SerializableTypes.UInt: |
| | 0 | 638 | | RemoveColumnInternal(ref allUintColumns, Serializable.SerializableTypes.UInt, columnID); |
| | 0 | 639 | | break; |
| | | 640 | | case Serializable.SerializableTypes.Long: |
| | 0 | 641 | | RemoveColumnInternal(ref allLongColumns, Serializable.SerializableTypes.Long, columnID); |
| | 0 | 642 | | break; |
| | | 643 | | case Serializable.SerializableTypes.ULong: |
| | 0 | 644 | | RemoveColumnInternal(ref allUlongColumns, Serializable.SerializableTypes.ULong, columnID); |
| | 0 | 645 | | break; |
| | | 646 | | case Serializable.SerializableTypes.Float: |
| | 0 | 647 | | RemoveColumnInternal(ref allFloatColumns, Serializable.SerializableTypes.Float, columnID); |
| | 0 | 648 | | break; |
| | | 649 | | case Serializable.SerializableTypes.Double: |
| | 0 | 650 | | RemoveColumnInternal(ref allDoubleColumns, Serializable.SerializableTypes.Double, columnID); |
| | 0 | 651 | | break; |
| | | 652 | | case Serializable.SerializableTypes.Vector2: |
| | 0 | 653 | | RemoveColumnInternal(ref allVector2Columns, Serializable.SerializableTypes.Vector2, columnID); |
| | 0 | 654 | | break; |
| | | 655 | | case Serializable.SerializableTypes.Vector3: |
| | 0 | 656 | | RemoveColumnInternal(ref allVector3Columns, Serializable.SerializableTypes.Vector3, columnID); |
| | 0 | 657 | | break; |
| | | 658 | | case Serializable.SerializableTypes.Vector4: |
| | 0 | 659 | | RemoveColumnInternal(ref allVector4Columns, Serializable.SerializableTypes.Vector4, columnID); |
| | 0 | 660 | | break; |
| | | 661 | | case Serializable.SerializableTypes.Vector2Int: |
| | 0 | 662 | | RemoveColumnInternal(ref allVector2IntColumns, Serializable.SerializableTypes.Vector2Int, columnID); |
| | 0 | 663 | | break; |
| | | 664 | | case Serializable.SerializableTypes.Vector3Int: |
| | 0 | 665 | | RemoveColumnInternal(ref allVector3IntColumns, Serializable.SerializableTypes.Vector3Int, columnID); |
| | 0 | 666 | | break; |
| | | 667 | | case Serializable.SerializableTypes.Quaternion: |
| | 0 | 668 | | RemoveColumnInternal(ref allQuaternionColumns, Serializable.SerializableTypes.Quaternion, columnID); |
| | 0 | 669 | | break; |
| | | 670 | | case Serializable.SerializableTypes.Rect: |
| | 0 | 671 | | RemoveColumnInternal(ref allRectColumns, Serializable.SerializableTypes.Rect, columnID); |
| | 0 | 672 | | break; |
| | | 673 | | case Serializable.SerializableTypes.RectInt: |
| | 0 | 674 | | RemoveColumnInternal(ref allRectIntColumns, Serializable.SerializableTypes.RectInt, columnID); |
| | 0 | 675 | | break; |
| | | 676 | | case Serializable.SerializableTypes.Color: |
| | 0 | 677 | | RemoveColumnInternal(ref allColorColumns, Serializable.SerializableTypes.Color, columnID); |
| | 0 | 678 | | break; |
| | | 679 | | case Serializable.SerializableTypes.LayerMask: |
| | 0 | 680 | | RemoveColumnInternal(ref allLayerMaskColumns, Serializable.SerializableTypes.LayerMask, columnID); |
| | 0 | 681 | | break; |
| | | 682 | | case Serializable.SerializableTypes.Bounds: |
| | 0 | 683 | | RemoveColumnInternal(ref allBoundsColumns, Serializable.SerializableTypes.Bounds, columnID); |
| | 0 | 684 | | break; |
| | | 685 | | case Serializable.SerializableTypes.BoundsInt: |
| | 0 | 686 | | RemoveColumnInternal(ref allBoundsIntColumns, Serializable.SerializableTypes.BoundsInt, columnID); |
| | 0 | 687 | | break; |
| | | 688 | | case Serializable.SerializableTypes.Hash128: |
| | 0 | 689 | | RemoveColumnInternal(ref allHash128Columns, Serializable.SerializableTypes.Hash128, columnID); |
| | 0 | 690 | | break; |
| | | 691 | | case Serializable.SerializableTypes.Gradient: |
| | 0 | 692 | | RemoveColumnInternal(ref allGradientColumns, Serializable.SerializableTypes.Gradient, columnID); |
| | 0 | 693 | | break; |
| | | 694 | | case Serializable.SerializableTypes.AnimationCurve: |
| | 0 | 695 | | RemoveColumnInternal(ref allAnimationCurveColumns, Serializable.SerializableTypes.AnimationCurve, co |
| | 0 | 696 | | break; |
| | | 697 | | case Serializable.SerializableTypes.Object: |
| | 0 | 698 | | RemoveColumnInternal(ref allObjectRefColumns, Serializable.SerializableTypes.Object, columnID); |
| | 0 | 699 | | break; |
| | | 700 | | } |
| | 0 | 701 | | } |
| | | 702 | | |
| | | 703 | | // Set |
| | | 704 | | |
| | | 705 | | public ulong SetString(int row, int column, string value) |
| | 0 | 706 | | { |
| | 0 | 707 | | return SetCell(row, column, ref allStringColumns, value); |
| | 0 | 708 | | } |
| | | 709 | | |
| | | 710 | | public ulong SetBool(int row, int column, bool value) |
| | 0 | 711 | | { |
| | 0 | 712 | | return SetCell(row, column, ref allBoolColumns, value); |
| | 0 | 713 | | } |
| | | 714 | | |
| | | 715 | | public ulong SetChar(int row, int column, char value) |
| | 0 | 716 | | { |
| | 0 | 717 | | return SetCell(row, column, ref allCharColumns, value); |
| | 0 | 718 | | } |
| | | 719 | | |
| | | 720 | | public ulong SetSByte(int row, int column, sbyte value) |
| | 0 | 721 | | { |
| | 0 | 722 | | return SetCell(row, column, ref allSbyteColumns, value); |
| | 0 | 723 | | } |
| | | 724 | | |
| | | 725 | | public ulong SetByte(int row, int column, byte value) |
| | 0 | 726 | | { |
| | 0 | 727 | | return SetCell(row, column, ref allByteColumns, value); |
| | 0 | 728 | | } |
| | | 729 | | |
| | | 730 | | public ulong SetShort(int row, int column, short value) |
| | 0 | 731 | | { |
| | 0 | 732 | | return SetCell(row, column, ref allShortColumns, value); |
| | 0 | 733 | | } |
| | | 734 | | |
| | | 735 | | public ulong SetUShort(int row, int column, ushort value) |
| | 0 | 736 | | { |
| | 0 | 737 | | return SetCell(row, column, ref allUshortColumns, value); |
| | 0 | 738 | | } |
| | | 739 | | |
| | | 740 | | public ulong SetInt(int row, int column, int value) |
| | 0 | 741 | | { |
| | 0 | 742 | | return SetCell(row, column, ref allIntColumns, value); |
| | 0 | 743 | | } |
| | | 744 | | |
| | | 745 | | public ulong SetUInt(int row, int column, uint value) |
| | 0 | 746 | | { |
| | 0 | 747 | | return SetCell(row, column, ref allUintColumns, value); |
| | 0 | 748 | | } |
| | | 749 | | |
| | | 750 | | public ulong SetLong(int row, int column, long value) |
| | 0 | 751 | | { |
| | 0 | 752 | | return SetCell(row, column, ref allLongColumns, value); |
| | 0 | 753 | | } |
| | | 754 | | |
| | | 755 | | public ulong SetULong(int row, int column, ulong value) |
| | 0 | 756 | | { |
| | 0 | 757 | | return SetCell(row, column, ref allUlongColumns, value); |
| | 0 | 758 | | } |
| | | 759 | | |
| | | 760 | | public ulong SetFloat(int row, int column, float value) |
| | 0 | 761 | | { |
| | 0 | 762 | | return SetCell(row, column, ref allFloatColumns, value); |
| | 0 | 763 | | } |
| | | 764 | | |
| | | 765 | | public ulong SetDouble(int row, int column, double value) |
| | 0 | 766 | | { |
| | 0 | 767 | | return SetCell(row, column, ref allDoubleColumns, value); |
| | 0 | 768 | | } |
| | | 769 | | |
| | | 770 | | public ulong SetVector2(int row, int column, Vector2 value) |
| | 0 | 771 | | { |
| | 0 | 772 | | return SetCell(row, column, ref allVector2Columns, value); |
| | 0 | 773 | | } |
| | | 774 | | |
| | | 775 | | public ulong SetVector3(int row, int column, Vector3 value) |
| | 0 | 776 | | { |
| | 0 | 777 | | return SetCell(row, column, ref allVector3Columns, value); |
| | 0 | 778 | | } |
| | | 779 | | |
| | | 780 | | public ulong SetVector4(int row, int column, Vector4 value) |
| | 0 | 781 | | { |
| | 0 | 782 | | return SetCell(row, column, ref allVector4Columns, value); |
| | 0 | 783 | | } |
| | | 784 | | |
| | | 785 | | public ulong SetVector2Int(int row, int column, Vector2Int value) |
| | 0 | 786 | | { |
| | 0 | 787 | | return SetCell(row, column, ref allVector2IntColumns, value); |
| | 0 | 788 | | } |
| | | 789 | | |
| | | 790 | | public ulong SetVector3Int(int row, int column, Vector3Int value) |
| | 0 | 791 | | { |
| | 0 | 792 | | return SetCell(row, column, ref allVector3IntColumns, value); |
| | 0 | 793 | | } |
| | | 794 | | |
| | | 795 | | public ulong SetQuaternion(int row, int column, Quaternion value) |
| | 0 | 796 | | { |
| | 0 | 797 | | return SetCell(row, column, ref allQuaternionColumns, value); |
| | 0 | 798 | | } |
| | | 799 | | |
| | | 800 | | public ulong SetRect(int row, int column, Rect value) |
| | 0 | 801 | | { |
| | 0 | 802 | | return SetCell(row, column, ref allRectColumns, value); |
| | 0 | 803 | | } |
| | | 804 | | |
| | | 805 | | public ulong SetRectInt(int row, int column, RectInt value) |
| | 0 | 806 | | { |
| | 0 | 807 | | return SetCell(row, column, ref allRectIntColumns, value); |
| | 0 | 808 | | } |
| | | 809 | | |
| | | 810 | | public ulong SetColor(int row, int column, Color value) |
| | 0 | 811 | | { |
| | 0 | 812 | | return SetCell(row, column, ref allColorColumns, value); |
| | 0 | 813 | | } |
| | | 814 | | |
| | | 815 | | public ulong SetLayerMask(int row, int column, LayerMask value) |
| | 0 | 816 | | { |
| | 0 | 817 | | return SetCell(row, column, ref allLayerMaskColumns, value); |
| | 0 | 818 | | } |
| | | 819 | | |
| | | 820 | | public ulong SetBounds(int row, int column, Bounds value) |
| | 0 | 821 | | { |
| | 0 | 822 | | return SetCell(row, column, ref allBoundsColumns, value); |
| | 0 | 823 | | } |
| | | 824 | | |
| | | 825 | | public ulong SetBoundsInt(int row, int column, BoundsInt value) |
| | 0 | 826 | | { |
| | 0 | 827 | | return SetCell(row, column, ref allBoundsIntColumns, value); |
| | 0 | 828 | | } |
| | | 829 | | |
| | | 830 | | public ulong SetHash128(int row, int column, Hash128 value) |
| | 0 | 831 | | { |
| | 0 | 832 | | return SetCell(row, column, ref allHash128Columns, value); |
| | 0 | 833 | | } |
| | | 834 | | |
| | | 835 | | public ulong SetGradient(int row, int column, Gradient value) |
| | 0 | 836 | | { |
| | 0 | 837 | | return SetCell(row, column, ref allGradientColumns, value); |
| | 0 | 838 | | } |
| | | 839 | | |
| | | 840 | | public ulong SetAnimationCurve(int row, int column, AnimationCurve value) |
| | 0 | 841 | | { |
| | 0 | 842 | | return SetCell(row, column, ref allAnimationCurveColumns, value); |
| | 0 | 843 | | } |
| | | 844 | | |
| | | 845 | | public ulong SetObject(int row, int column, UnityEngine.Object value) |
| | 0 | 846 | | { |
| | 0 | 847 | | return SetCell(row, column, ref allObjectRefColumns, value); |
| | 0 | 848 | | } |
| | | 849 | | |
| | | 850 | | // Get |
| | | 851 | | public string GetString(int row, int column) |
| | 0 | 852 | | { |
| | 0 | 853 | | return GetCell(row, column, ref allStringColumns); |
| | 0 | 854 | | } |
| | | 855 | | |
| | | 856 | | public bool GetBool(int row, int column) |
| | 0 | 857 | | { |
| | 0 | 858 | | return GetCell(row, column, ref allBoolColumns); |
| | 0 | 859 | | } |
| | | 860 | | |
| | | 861 | | public char GetChar(int row, int column) |
| | 0 | 862 | | { |
| | 0 | 863 | | return GetCell(row, column, ref allCharColumns); |
| | 0 | 864 | | } |
| | | 865 | | |
| | | 866 | | public sbyte GetSByte(int row, int column) |
| | 0 | 867 | | { |
| | 0 | 868 | | return GetCell(row, column, ref allSbyteColumns); |
| | 0 | 869 | | } |
| | | 870 | | |
| | | 871 | | public byte GetByte(int row, int column) |
| | 0 | 872 | | { |
| | 0 | 873 | | return GetCell(row, column, ref allByteColumns); |
| | 0 | 874 | | } |
| | | 875 | | |
| | | 876 | | public short GetShort(int row, int column) |
| | 0 | 877 | | { |
| | 0 | 878 | | return GetCell(row, column, ref allShortColumns); |
| | 0 | 879 | | } |
| | | 880 | | |
| | | 881 | | public ushort GetUShort(int row, int column) |
| | 0 | 882 | | { |
| | 0 | 883 | | return GetCell(row, column, ref allUshortColumns); |
| | 0 | 884 | | } |
| | | 885 | | |
| | | 886 | | public int GetInt(int row, int column) |
| | 0 | 887 | | { |
| | 0 | 888 | | return GetCell(row, column, ref allIntColumns); |
| | 0 | 889 | | } |
| | | 890 | | |
| | | 891 | | public uint GetUInt(int row, int column) |
| | 0 | 892 | | { |
| | 0 | 893 | | return GetCell(row, column, ref allUintColumns); |
| | 0 | 894 | | } |
| | | 895 | | |
| | | 896 | | public long GetLong(int row, int column) |
| | 0 | 897 | | { |
| | 0 | 898 | | return GetCell(row, column, ref allLongColumns); |
| | 0 | 899 | | } |
| | | 900 | | |
| | | 901 | | public ulong GetULong(int row, int column) |
| | 0 | 902 | | { |
| | 0 | 903 | | return GetCell(row, column, ref allUlongColumns); |
| | 0 | 904 | | } |
| | | 905 | | |
| | | 906 | | public float GetFloat(int row, int column) |
| | 0 | 907 | | { |
| | 0 | 908 | | return GetCell(row, column, ref allFloatColumns); |
| | 0 | 909 | | } |
| | | 910 | | |
| | | 911 | | public double GetDouble(int row, int column) |
| | 0 | 912 | | { |
| | 0 | 913 | | return GetCell(row, column, ref allDoubleColumns); |
| | 0 | 914 | | } |
| | | 915 | | |
| | | 916 | | public Vector2 GetVector2(int row, int column) |
| | 0 | 917 | | { |
| | 0 | 918 | | return GetCell(row, column, ref allVector2Columns); |
| | 0 | 919 | | } |
| | | 920 | | |
| | | 921 | | public Vector3 GetVector3(int row, int column) |
| | 0 | 922 | | { |
| | 0 | 923 | | return GetCell(row, column, ref allVector3Columns); |
| | 0 | 924 | | } |
| | | 925 | | |
| | | 926 | | public Vector4 GetVector4(int row, int column) |
| | 0 | 927 | | { |
| | 0 | 928 | | return GetCell(row, column, ref allVector4Columns); |
| | 0 | 929 | | } |
| | | 930 | | |
| | | 931 | | public Vector2Int GetVector2Int(int row, int column) |
| | 0 | 932 | | { |
| | 0 | 933 | | return GetCell(row, column, ref allVector2IntColumns); |
| | 0 | 934 | | } |
| | | 935 | | |
| | | 936 | | public Vector3Int GetVector3Int(int row, int column) |
| | 0 | 937 | | { |
| | 0 | 938 | | return GetCell(row, column, ref allVector3IntColumns); |
| | 0 | 939 | | } |
| | | 940 | | |
| | | 941 | | public Quaternion GetQuaternion(int row, int column) |
| | 0 | 942 | | { |
| | 0 | 943 | | return GetCell(row, column, ref allQuaternionColumns); |
| | 0 | 944 | | } |
| | | 945 | | |
| | | 946 | | public Rect GetRect(int row, int column) |
| | 0 | 947 | | { |
| | 0 | 948 | | return GetCell(row, column, ref allRectColumns); |
| | 0 | 949 | | } |
| | | 950 | | |
| | | 951 | | public RectInt GetRectInt(int row, int column) |
| | 0 | 952 | | { |
| | 0 | 953 | | return GetCell(row, column, ref allRectIntColumns); |
| | 0 | 954 | | } |
| | | 955 | | |
| | | 956 | | public Color GetColor(int row, int column) |
| | 0 | 957 | | { |
| | 0 | 958 | | return GetCell(row, column, ref allColorColumns); |
| | 0 | 959 | | } |
| | | 960 | | |
| | | 961 | | public LayerMask GetLayerMask(int row, int column) |
| | 0 | 962 | | { |
| | 0 | 963 | | return GetCell(row, column, ref allLayerMaskColumns); |
| | 0 | 964 | | } |
| | | 965 | | |
| | | 966 | | public Bounds GetBounds(int row, int column) |
| | 0 | 967 | | { |
| | 0 | 968 | | return GetCell(row, column, ref allBoundsColumns); |
| | 0 | 969 | | } |
| | | 970 | | |
| | | 971 | | public BoundsInt GetBoundsInt(int row, int column) |
| | 0 | 972 | | { |
| | 0 | 973 | | return GetCell(row, column, ref allBoundsIntColumns); |
| | 0 | 974 | | } |
| | | 975 | | |
| | | 976 | | public Hash128 GetHash128(int row, int column) |
| | 0 | 977 | | { |
| | 0 | 978 | | return GetCell(row, column, ref allHash128Columns); |
| | 0 | 979 | | } |
| | | 980 | | |
| | | 981 | | public Gradient GetGradient(int row, int column) |
| | 0 | 982 | | { |
| | 0 | 983 | | return GetCell(row, column, ref allGradientColumns); |
| | 0 | 984 | | } |
| | | 985 | | |
| | | 986 | | public AnimationCurve GetAnimationCurve(int row, int column) |
| | 0 | 987 | | { |
| | 0 | 988 | | return GetCell(row, column, ref allAnimationCurveColumns); |
| | 0 | 989 | | } |
| | | 990 | | |
| | | 991 | | public UnityEngine.Object GetObject(int row, int column) |
| | 0 | 992 | | { |
| | 0 | 993 | | return GetCell(row, column, ref allObjectRefColumns); |
| | 0 | 994 | | } |
| | | 995 | | |
| | | 996 | | // Get ref |
| | | 997 | | |
| | | 998 | | public ref string GetStringRef(int row, int column) |
| | 0 | 999 | | { |
| | 0 | 1000 | | return ref GetCellRef(row, column, ref allStringColumns); |
| | 0 | 1001 | | } |
| | | 1002 | | |
| | | 1003 | | public ref bool GetBoolRef(int row, int column) |
| | 0 | 1004 | | { |
| | 0 | 1005 | | return ref GetCellRef(row, column, ref allBoolColumns); |
| | 0 | 1006 | | } |
| | | 1007 | | |
| | | 1008 | | public ref char GetCharRef(int row, int column) |
| | 0 | 1009 | | { |
| | 0 | 1010 | | return ref GetCellRef(row, column, ref allCharColumns); |
| | 0 | 1011 | | } |
| | | 1012 | | |
| | | 1013 | | public ref sbyte GetSbyteRef(int row, int column) |
| | 0 | 1014 | | { |
| | 0 | 1015 | | return ref GetCellRef(row, column, ref allSbyteColumns); |
| | 0 | 1016 | | } |
| | | 1017 | | |
| | | 1018 | | public ref byte GetByteRef(int row, int columnID) |
| | 0 | 1019 | | { |
| | 0 | 1020 | | return ref GetCellRef(row, columnID, ref allByteColumns); |
| | 0 | 1021 | | } |
| | | 1022 | | |
| | | 1023 | | public ref short GetShortRef(int row, int column) |
| | 0 | 1024 | | { |
| | 0 | 1025 | | return ref GetCellRef(row, column, ref allShortColumns); |
| | 0 | 1026 | | } |
| | | 1027 | | |
| | | 1028 | | public ref ushort GetUshortRef(int row, int column) |
| | 0 | 1029 | | { |
| | 0 | 1030 | | return ref GetCellRef(row, column, ref allUshortColumns); |
| | 0 | 1031 | | } |
| | | 1032 | | |
| | | 1033 | | public ref int GetIntRef(int row, int column) |
| | 0 | 1034 | | { |
| | 0 | 1035 | | return ref GetCellRef(row, column, ref allIntColumns); |
| | 0 | 1036 | | } |
| | | 1037 | | |
| | | 1038 | | public ref uint GetUintRef(int row, int column) |
| | 0 | 1039 | | { |
| | 0 | 1040 | | return ref GetCellRef(row, column, ref allUintColumns); |
| | 0 | 1041 | | } |
| | | 1042 | | |
| | | 1043 | | public ref long GetLongRef(int row, int column) |
| | 0 | 1044 | | { |
| | 0 | 1045 | | return ref GetCellRef(row, column, ref allLongColumns); |
| | 0 | 1046 | | } |
| | | 1047 | | |
| | | 1048 | | public ref ulong GetUlongRef(int row, int column) |
| | 0 | 1049 | | { |
| | 0 | 1050 | | return ref GetCellRef(row, column, ref allUlongColumns); |
| | 0 | 1051 | | } |
| | | 1052 | | |
| | | 1053 | | public ref float GetFloatRef(int row, int column) |
| | 0 | 1054 | | { |
| | 0 | 1055 | | return ref GetCellRef(row, column, ref allFloatColumns); |
| | 0 | 1056 | | } |
| | | 1057 | | |
| | | 1058 | | public ref double GetDoubleRef(int row, int column) |
| | 0 | 1059 | | { |
| | 0 | 1060 | | return ref GetCellRef(row, column, ref allDoubleColumns); |
| | 0 | 1061 | | } |
| | | 1062 | | |
| | | 1063 | | public ref Vector2 GetVector2Ref(int row, int column) |
| | 0 | 1064 | | { |
| | 0 | 1065 | | return ref GetCellRef(row, column, ref allVector2Columns); |
| | 0 | 1066 | | } |
| | | 1067 | | |
| | | 1068 | | public ref Vector3 GetVector3Ref(int row, int column) |
| | 0 | 1069 | | { |
| | 0 | 1070 | | return ref GetCellRef(row, column, ref allVector3Columns); |
| | 0 | 1071 | | } |
| | | 1072 | | |
| | | 1073 | | public ref Vector4 GetVector4Ref(int row, int column) |
| | 0 | 1074 | | { |
| | 0 | 1075 | | return ref GetCellRef(row, column, ref allVector4Columns); |
| | 0 | 1076 | | } |
| | | 1077 | | |
| | | 1078 | | public ref Vector2Int GetVector2IntRef(int row, int column) |
| | 0 | 1079 | | { |
| | 0 | 1080 | | return ref GetCellRef(row, column, ref allVector2IntColumns); |
| | 0 | 1081 | | } |
| | | 1082 | | |
| | | 1083 | | public ref Vector3Int GetVector3IntRef(int row, int column) |
| | 0 | 1084 | | { |
| | 0 | 1085 | | return ref GetCellRef(row, column, ref allVector3IntColumns); |
| | 0 | 1086 | | } |
| | | 1087 | | |
| | | 1088 | | public ref Quaternion GetQuaternionRef(int row, int column) |
| | 0 | 1089 | | { |
| | 0 | 1090 | | return ref GetCellRef(row, column, ref allQuaternionColumns); |
| | 0 | 1091 | | } |
| | | 1092 | | |
| | | 1093 | | public ref Rect GetRectRef(int row, int column) |
| | 0 | 1094 | | { |
| | 0 | 1095 | | return ref GetCellRef(row, column, ref allRectColumns); |
| | 0 | 1096 | | } |
| | | 1097 | | |
| | | 1098 | | public ref RectInt GetRectIntRef(int row, int column) |
| | 0 | 1099 | | { |
| | 0 | 1100 | | return ref GetCellRef(row, column, ref allRectIntColumns); |
| | 0 | 1101 | | } |
| | | 1102 | | |
| | | 1103 | | public ref Color GetColorRef(int row, int column) |
| | 0 | 1104 | | { |
| | 0 | 1105 | | return ref GetCellRef(row, column, ref allColorColumns); |
| | 0 | 1106 | | } |
| | | 1107 | | |
| | | 1108 | | public ref LayerMask GetLayerMaskRef(int row, int column) |
| | 0 | 1109 | | { |
| | 0 | 1110 | | return ref GetCellRef(row, column, ref allLayerMaskColumns); |
| | 0 | 1111 | | } |
| | | 1112 | | |
| | | 1113 | | public ref Bounds GetBoundsRef(int row, int column) |
| | 0 | 1114 | | { |
| | 0 | 1115 | | return ref GetCellRef(row, column, ref allBoundsColumns); |
| | 0 | 1116 | | } |
| | | 1117 | | |
| | | 1118 | | public ref BoundsInt GetBoundsIntRef(int row, int column) |
| | 0 | 1119 | | { |
| | 0 | 1120 | | return ref GetCellRef(row, column, ref allBoundsIntColumns); |
| | 0 | 1121 | | } |
| | | 1122 | | |
| | | 1123 | | public ref Hash128 GetHash128Ref(int row, int column) |
| | 0 | 1124 | | { |
| | 0 | 1125 | | return ref GetCellRef(row, column, ref allHash128Columns); |
| | 0 | 1126 | | } |
| | | 1127 | | |
| | | 1128 | | public ref Gradient GetGradientRef(int row, int column) |
| | 0 | 1129 | | { |
| | 0 | 1130 | | return ref GetCellRef(row, column, ref allGradientColumns); |
| | 0 | 1131 | | } |
| | | 1132 | | |
| | | 1133 | | public ref AnimationCurve GetAnimationCurveRef(int row, int column) |
| | 0 | 1134 | | { |
| | 0 | 1135 | | return ref GetCellRef(row, column, ref allAnimationCurveColumns); |
| | 0 | 1136 | | } |
| | | 1137 | | |
| | | 1138 | | public ref UnityEngine.Object GetObjectRef(int row, int column) |
| | 0 | 1139 | | { |
| | 0 | 1140 | | return ref GetCellRef(row, column, ref allObjectRefColumns); |
| | 0 | 1141 | | } |
| | | 1142 | | |
| | | 1143 | | // Get Column |
| | | 1144 | | |
| | | 1145 | | public string[] GetStringColumn(int column) |
| | 0 | 1146 | | { |
| | 0 | 1147 | | return GetColumn(column, ref allStringColumns); |
| | 0 | 1148 | | } |
| | | 1149 | | |
| | | 1150 | | public bool[] GetBoolColumn(int column) |
| | 0 | 1151 | | { |
| | 0 | 1152 | | return GetColumn(column, ref allBoolColumns); |
| | 0 | 1153 | | } |
| | | 1154 | | |
| | | 1155 | | public char[] GetCharColumn(int column) |
| | 0 | 1156 | | { |
| | 0 | 1157 | | return GetColumn(column, ref allCharColumns); |
| | 0 | 1158 | | } |
| | | 1159 | | |
| | | 1160 | | public sbyte[] GetSbyteColumn(int column) |
| | 0 | 1161 | | { |
| | 0 | 1162 | | return GetColumn(column, ref allSbyteColumns); |
| | 0 | 1163 | | } |
| | | 1164 | | |
| | | 1165 | | public byte[] GetByteColumn(int column) |
| | 0 | 1166 | | { |
| | 0 | 1167 | | return GetColumn(column, ref allByteColumns); |
| | 0 | 1168 | | } |
| | | 1169 | | |
| | | 1170 | | public short[] GetShortColumn(int column) |
| | 0 | 1171 | | { |
| | 0 | 1172 | | return GetColumn(column, ref allShortColumns); |
| | 0 | 1173 | | } |
| | | 1174 | | |
| | | 1175 | | public ushort[] GetUshortColumn(int column) |
| | 0 | 1176 | | { |
| | 0 | 1177 | | return GetColumn(column, ref allUshortColumns); |
| | 0 | 1178 | | } |
| | | 1179 | | |
| | | 1180 | | public int[] GetIntColumn(int column) |
| | 0 | 1181 | | { |
| | 0 | 1182 | | return GetColumn(column, ref allIntColumns); |
| | 0 | 1183 | | } |
| | | 1184 | | |
| | | 1185 | | public uint[] GetUintColumn(int column) |
| | 0 | 1186 | | { |
| | 0 | 1187 | | return GetColumn(column, ref allUintColumns); |
| | 0 | 1188 | | } |
| | | 1189 | | |
| | | 1190 | | public long[] GetLongColumn(int column) |
| | 0 | 1191 | | { |
| | 0 | 1192 | | return GetColumn(column, ref allLongColumns); |
| | 0 | 1193 | | } |
| | | 1194 | | |
| | | 1195 | | public ulong[] GetUlongColumn(int column) |
| | 0 | 1196 | | { |
| | 0 | 1197 | | return GetColumn(column, ref allUlongColumns); |
| | 0 | 1198 | | } |
| | | 1199 | | |
| | | 1200 | | public float[] GetFloatColumn(int column) |
| | 0 | 1201 | | { |
| | 0 | 1202 | | return GetColumn(column, ref allFloatColumns); |
| | 0 | 1203 | | } |
| | | 1204 | | |
| | | 1205 | | public double[] GetDoubleColumn(int column) |
| | 0 | 1206 | | { |
| | 0 | 1207 | | return GetColumn(column, ref allDoubleColumns); |
| | 0 | 1208 | | } |
| | | 1209 | | |
| | | 1210 | | public Vector2[] GetVector2Column(int column) |
| | 0 | 1211 | | { |
| | 0 | 1212 | | return GetColumn(column, ref allVector2Columns); |
| | 0 | 1213 | | } |
| | | 1214 | | |
| | | 1215 | | public Vector3[] GetVector3Column(int column) |
| | 0 | 1216 | | { |
| | 0 | 1217 | | return GetColumn(column, ref allVector3Columns); |
| | 0 | 1218 | | } |
| | | 1219 | | |
| | | 1220 | | public Vector4[] GetVector4Column(int column) |
| | 0 | 1221 | | { |
| | 0 | 1222 | | return GetColumn(column, ref allVector4Columns); |
| | 0 | 1223 | | } |
| | | 1224 | | |
| | | 1225 | | public Vector2Int[] GetVector2IntColumn(int column) |
| | 0 | 1226 | | { |
| | 0 | 1227 | | return GetColumn(column, ref allVector2IntColumns); |
| | 0 | 1228 | | } |
| | | 1229 | | |
| | | 1230 | | public Vector3Int[] GetVector3IntColumn(int column) |
| | 0 | 1231 | | { |
| | 0 | 1232 | | return GetColumn(column, ref allVector3IntColumns); |
| | 0 | 1233 | | } |
| | | 1234 | | |
| | | 1235 | | public Quaternion[] GetQuaternionColumn(int column) |
| | 0 | 1236 | | { |
| | 0 | 1237 | | return GetColumn(column, ref allQuaternionColumns); |
| | 0 | 1238 | | } |
| | | 1239 | | |
| | | 1240 | | public Rect[] GetRectColumn(int column) |
| | 0 | 1241 | | { |
| | 0 | 1242 | | return GetColumn(column, ref allRectColumns); |
| | 0 | 1243 | | } |
| | | 1244 | | |
| | | 1245 | | public RectInt[] GetRectIntColumn(int column) |
| | 0 | 1246 | | { |
| | 0 | 1247 | | return GetColumn(column, ref allRectIntColumns); |
| | 0 | 1248 | | } |
| | | 1249 | | |
| | | 1250 | | public Color[] GetColorColumn(int column) |
| | 0 | 1251 | | { |
| | 0 | 1252 | | return GetColumn(column, ref allColorColumns); |
| | 0 | 1253 | | } |
| | | 1254 | | |
| | | 1255 | | public LayerMask[] GetLayerMaskColumn(int column) |
| | 0 | 1256 | | { |
| | 0 | 1257 | | return GetColumn(column, ref allLayerMaskColumns); |
| | 0 | 1258 | | } |
| | | 1259 | | |
| | | 1260 | | public Bounds[] GetBoundsColumn(int column) |
| | 0 | 1261 | | { |
| | 0 | 1262 | | return GetColumn(column, ref allBoundsColumns); |
| | 0 | 1263 | | } |
| | | 1264 | | |
| | | 1265 | | public BoundsInt[] GetBoundsIntColumn(int column) |
| | 0 | 1266 | | { |
| | 0 | 1267 | | return GetColumn(column, ref allBoundsIntColumns); |
| | 0 | 1268 | | } |
| | | 1269 | | |
| | | 1270 | | public Hash128[] GetHash128Column(int column) |
| | 0 | 1271 | | { |
| | 0 | 1272 | | return GetColumn(column, ref allHash128Columns); |
| | 0 | 1273 | | } |
| | | 1274 | | |
| | | 1275 | | public Gradient[] GetGradientColumn(int column) |
| | 0 | 1276 | | { |
| | 0 | 1277 | | return GetColumn(column, ref allGradientColumns); |
| | 0 | 1278 | | } |
| | | 1279 | | |
| | | 1280 | | public AnimationCurve[] GetAnimationCurveColumn(int column) |
| | 0 | 1281 | | { |
| | 0 | 1282 | | return GetColumn(column, ref allAnimationCurveColumns); |
| | 0 | 1283 | | } |
| | | 1284 | | |
| | | 1285 | | public UnityEngine.Object[] GetObjectColumn(int column) |
| | 0 | 1286 | | { |
| | 0 | 1287 | | return GetColumn(column, ref allObjectRefColumns); |
| | 0 | 1288 | | } |
| | | 1289 | | |
| | | 1290 | | // Internal |
| | | 1291 | | |
| | | 1292 | | internal int AddColumnInternal<T>(string columnName, ref ArrayHolder<T>[] allColumnsOfType, Serializable.Seriali |
| | 0 | 1293 | | { |
| | 0 | 1294 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1295 | | Array.Resize(ref allColumnsOfType, columnCount + 1); |
| | 0 | 1296 | | allColumnsOfType[columnCount].TArray = new T[rowCount]; |
| | | 1297 | | |
| | 0 | 1298 | | string[] columnNamesForType = allColumnNames[(int)typeIndex].TArray; |
| | 0 | 1299 | | int columnNamesCount = columnNamesForType?.Length ?? 0; |
| | 0 | 1300 | | Array.Resize(ref columnNamesForType, columnNamesCount + 1); |
| | 0 | 1301 | | columnNamesForType[columnNamesCount] = columnName; |
| | 0 | 1302 | | allColumnNames[(int)typeIndex].TArray = columnNamesForType; |
| | | 1303 | | |
| | 0 | 1304 | | int columnID = columnEntriesFreeListHead; |
| | 0 | 1305 | | int columnIDToDenseIndexMapLength = columnIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 1306 | | if (columnID >= columnIDToDenseIndexMapLength) |
| | 0 | 1307 | | { |
| | 0 | 1308 | | int newSize = columnID * 2; |
| | 0 | 1309 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 1310 | | Array.Resize(ref columnIDToDenseIndexMap, newSize); |
| | 0 | 1311 | | for (int i = columnID; i < newSize; i++) |
| | 0 | 1312 | | { |
| | 0 | 1313 | | ref ColumnEntry entry = ref columnIDToDenseIndexMap[columnID + i]; |
| | 0 | 1314 | | entry.columnDenseIndex = columnID + i + 1; |
| | 0 | 1315 | | entry.ColumnType = Serializable.SerializableTypes.Invalid; |
| | 0 | 1316 | | } |
| | | 1317 | | |
| | 0 | 1318 | | Array.Resize(ref columnIDToSortOrderMap, newSize); |
| | 0 | 1319 | | for (int i = 0; i < columnID; i++) |
| | 0 | 1320 | | { |
| | 0 | 1321 | | columnIDToSortOrderMap[columnID + i] = -1; |
| | 0 | 1322 | | } |
| | 0 | 1323 | | } |
| | | 1324 | | |
| | 0 | 1325 | | ref int[] denseIndexToIDMap = ref columnDenseIndexToIDMap[(int)typeIndex].TArray; |
| | 0 | 1326 | | int denseIndexToIDMapLength = denseIndexToIDMap?.Length ?? 0; |
| | 0 | 1327 | | Array.Resize(ref denseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 1328 | | denseIndexToIDMap[denseIndexToIDMapLength] = columnID; |
| | | 1329 | | |
| | 0 | 1330 | | ref ColumnEntry newEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 1331 | | newEntry.columnDenseIndex = denseIndexToIDMapLength; |
| | 0 | 1332 | | newEntry.ColumnType = typeIndex; |
| | | 1333 | | |
| | 0 | 1334 | | insertAtSortedIndex = insertAtSortedIndex < 0 ? combinedColumnCount : insertAtSortedIndex; |
| | 0 | 1335 | | Array.Resize(ref sortedOrderToColumnIDMap, combinedColumnCount + 1); |
| | 0 | 1336 | | for (int i = combinedColumnCount; i > insertAtSortedIndex; i--) |
| | 0 | 1337 | | { |
| | 0 | 1338 | | int currentColumnID = sortedOrderToColumnIDMap[i - 1]; |
| | 0 | 1339 | | sortedOrderToColumnIDMap[i] = currentColumnID; |
| | 0 | 1340 | | columnIDToSortOrderMap[currentColumnID] = i; |
| | 0 | 1341 | | } |
| | | 1342 | | |
| | 0 | 1343 | | columnEntriesFreeListHead = columnIDToSortOrderMap[columnID]; |
| | 0 | 1344 | | columnIDToSortOrderMap[columnID] = insertAtSortedIndex; |
| | 0 | 1345 | | sortedOrderToColumnIDMap[insertAtSortedIndex] = columnID; |
| | | 1346 | | |
| | 0 | 1347 | | ++combinedColumnCount; |
| | 0 | 1348 | | dataVersion++; |
| | | 1349 | | |
| | 0 | 1350 | | return columnID; |
| | 0 | 1351 | | } |
| | | 1352 | | |
| | | 1353 | | internal void RemoveColumnInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, Serializable.SerializableTypes type |
| | 0 | 1354 | | { |
| | 0 | 1355 | | int columnLocation = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | | 1356 | | |
| | 0 | 1357 | | int lastIndex = allColumnsOfType.Length - 1; |
| | 0 | 1358 | | allColumnsOfType[columnLocation] = allColumnsOfType[lastIndex]; |
| | 0 | 1359 | | Array.Resize(ref allColumnsOfType, lastIndex); |
| | | 1360 | | |
| | 0 | 1361 | | ref string[] columnNamesOfType = ref allColumnNames[(int)typeIndex].TArray; |
| | 0 | 1362 | | columnNamesOfType[columnLocation] = columnNamesOfType[lastIndex]; |
| | 0 | 1363 | | Array.Resize(ref columnNamesOfType, lastIndex); |
| | | 1364 | | |
| | 0 | 1365 | | int columnOrder = columnIDToSortOrderMap[columnID]; |
| | | 1366 | | |
| | 0 | 1367 | | ref int[] denseIndicesOfType = ref columnDenseIndexToIDMap[(int)typeIndex].TArray; |
| | 0 | 1368 | | int sparseIndexToSwap = denseIndicesOfType[lastIndex]; |
| | | 1369 | | |
| | 0 | 1370 | | ref ColumnEntry sparseIndexToFree = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 1371 | | sparseIndexToFree.ColumnType = Serializable.SerializableTypes.Invalid; |
| | 0 | 1372 | | sparseIndexToFree.columnDenseIndex = columnEntriesFreeListHead; |
| | 0 | 1373 | | columnEntriesFreeListHead = columnID; |
| | | 1374 | | |
| | 0 | 1375 | | columnIDToDenseIndexMap[sparseIndexToSwap].columnDenseIndex = columnLocation; |
| | 0 | 1376 | | denseIndicesOfType[columnLocation] = sparseIndexToSwap; |
| | 0 | 1377 | | Array.Resize(ref denseIndicesOfType, lastIndex); |
| | | 1378 | | |
| | 0 | 1379 | | for (int i = columnOrder + 1; i < combinedColumnCount; i++) |
| | 0 | 1380 | | { |
| | 0 | 1381 | | int currentColumnID = sortedOrderToColumnIDMap[i]; |
| | 0 | 1382 | | sortedOrderToColumnIDMap[i - 1] = currentColumnID; |
| | 0 | 1383 | | columnIDToSortOrderMap[currentColumnID] = i - 1; |
| | 0 | 1384 | | } |
| | | 1385 | | |
| | 0 | 1386 | | Array.Resize(ref sortedOrderToColumnIDMap, combinedColumnCount - 1); |
| | | 1387 | | |
| | 0 | 1388 | | --combinedColumnCount; |
| | 0 | 1389 | | dataVersion++; |
| | 0 | 1390 | | } |
| | | 1391 | | |
| | | 1392 | | internal void InsertRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int insertAt, int numberOfNewRo |
| | 0 | 1393 | | { |
| | 0 | 1394 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1395 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1396 | | { |
| | 0 | 1397 | | ref T[] column = ref allColumnsOfType[i].TArray; |
| | 0 | 1398 | | int newRowCount = rowCount + numberOfNewRows; |
| | 0 | 1399 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1400 | | for (int j = newRowCount - 1; j > insertAt + numberOfNewRows - 1; j--) |
| | 0 | 1401 | | { |
| | 0 | 1402 | | column[j] = column[j - numberOfNewRows]; |
| | 0 | 1403 | | } |
| | | 1404 | | |
| | 0 | 1405 | | for (int j = 0; j < numberOfNewRows; j++) |
| | 0 | 1406 | | { |
| | 0 | 1407 | | column[insertAt + j] = default; |
| | 0 | 1408 | | } |
| | 0 | 1409 | | } |
| | 0 | 1410 | | } |
| | | 1411 | | |
| | | 1412 | | internal void DeleteRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int removeAt, int numberOfRowsT |
| | 0 | 1413 | | { |
| | 0 | 1414 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | | 1415 | | |
| | 0 | 1416 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1417 | | { |
| | 0 | 1418 | | ref T[] column = ref allColumnsOfType[i].TArray; |
| | 0 | 1419 | | int newRowCount = rowCount - numberOfRowsToDelete; |
| | | 1420 | | |
| | 0 | 1421 | | for (int j = removeAt; j < rowCount - numberOfRowsToDelete; j++) |
| | 0 | 1422 | | { |
| | 0 | 1423 | | column[j] = column[j + numberOfRowsToDelete]; |
| | 0 | 1424 | | } |
| | | 1425 | | |
| | 0 | 1426 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1427 | | } |
| | 0 | 1428 | | } |
| | | 1429 | | |
| | | 1430 | | internal ref T GetCellRef<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1431 | | { |
| | 0 | 1432 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1433 | | return ref allColumnsOfType[column][rowID]; |
| | 0 | 1434 | | } |
| | | 1435 | | |
| | | 1436 | | internal T GetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1437 | | { |
| | 0 | 1438 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1439 | | return allColumnsOfType[column][rowID]; |
| | 0 | 1440 | | } |
| | | 1441 | | |
| | | 1442 | | internal ulong SetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType, T value) |
| | 0 | 1443 | | { |
| | 0 | 1444 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1445 | | allColumnsOfType[column][rowID] = value; |
| | 0 | 1446 | | dataVersion++; |
| | 0 | 1447 | | return dataVersion; |
| | 0 | 1448 | | } |
| | | 1449 | | |
| | | 1450 | | internal T[] GetColumn<T>(int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1451 | | { |
| | 0 | 1452 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1453 | | return allColumnsOfType[column].TArray; |
| | 0 | 1454 | | } |
| | | 1455 | | } |
| | | 1456 | | } |